import { axios } from '@/utils/request'

const api = {
  role: '/auth/get-role-list',
  permission: '/auth/get-permission',
  createRole: '/auth/create-role',
  editRole: '/auth/edit-role',
  deleteRole: '/auth/delete-role',
  getAdminList: '/auth/get-admin-list',
  getAdminListBySaas: '/auth/get-admin-list-by-saas',
  createAdmin: '/auth/create-admin',
  editAdmin: '/auth/edit-admin',
  deleteAdmin: '/auth/delete-admin',
  getActionLog: '/auth/get-action-log',
  deleteActionLog: '/auth/delete-action-log',
  editPassword: '/auth/edit-password',
  editPasswordBySaas: '/auth/edit-password-by-saas',
  editAdminBySaas: '/auth/edit-admin-by-saas',
  generateTokenBySaas: '/auth/generate-token-by-saas',
  generateTokenByAdmin: '/auth/generate-token-by-admin',
  generateTokenBySupplier: '/auth/generate-token-by-supplier',
  generateTokenByMd: '/auth/generate-token-by-md',
  // 修改代理商状态
  changeAgencyStatus: '/auth/edit-admin-status-by-saas',
  generateTokenByGoodsAgent: '/auth/generate-token-by-goods-agent',
  generateTokenByFrontAgent: '/auth/generate-token-by-front-agent',
  getAreaAgent: '/auth/get-area-agent',

  getAgentApplyList: '/auth/get-agent-apply-list',
  setAgentApplyStatus: '/auth/set-agent-apply-status',
}

export default api

export function getRoleList(parameter) {
  return axios({
    url: api.role,
    method: 'get',
    params: parameter,
  })
}

export function getPermission(parameter) {
  return axios({
    url: api.permission,
    method: 'get',
    params: parameter,
  })
}

export function createRole(parameter) {
  return axios({
    url: api.createRole,
    method: 'post',
    data: parameter,
  })
}

export function editRole(parameter) {
  return axios({
    url: api.editRole,
    method: 'post',
    data: parameter,
  })
}

export function deleteRole(parameter) {
  return axios({
    url: api.deleteRole,
    method: 'post',
    data: parameter,
  })
}

export function getAdminList(parameter) {
  return axios({
    url: api.getAdminList,
    method: 'get',
    params: parameter,
  })
}

export function getAdminListBySaas(parameter) {
  return axios({
    url: api.getAdminListBySaas,
    method: 'get',
    params: parameter,
  })
}

export function createAdmin(parameter) {
  return axios({
    url: api.createAdmin,
    method: 'post',
    data: parameter,
  })
}

export function editAdmin(parameter) {
  return axios({
    url: api.editAdmin,
    method: 'post',
    data: parameter,
  })
}

export function deleteAdmin(parameter) {
  return axios({
    url: api.deleteAdmin,
    method: 'post',
    data: parameter,
  })
}

export function getActionLog(parameter) {
  return axios({
    url: api.getActionLog,
    method: 'get',
    params: parameter,
  })
}

export function deleteActionLog(parameter) {
  return axios({
    url: api.deleteActionLog,
    method: 'post',
    data: parameter,
  })
}

export function editPassword(parameter) {
  return axios({
    url: api.editPassword,
    method: 'post',
    data: parameter,
  })
}

export function editPasswordBySaas(parameter) {
  return axios({
    url: api.editPasswordBySaas,
    method: 'post',
    data: parameter,
  })
}

export function editAdminBySaas(parameter) {
  return axios({
    url: api.editAdminBySaas,
    method: 'post',
    data: parameter,
  })
}

export function generateTokenBySaas(parameter) {
  return axios({
    url: api.generateTokenBySaas,
    method: 'post',
    data: parameter,
  })
}

export function generateTokenByAdmin(parameter) {
  return axios({
    url: api.generateTokenByAdmin,
    method: 'post',
    data: parameter,
  })
}

export function generateTokenByMd(parameter) {
  return axios({
    url: api.generateTokenByMd,
    method: 'post',
    data: parameter,
  })
}

export function generateTokenBySupplier(parameter) {
  return axios({
    url: api.generateTokenBySupplier,
    method: 'post',
    data: parameter,
  })
}

export function changeAgencyStatus(parameter) {
  return axios({
    url: api.changeAgencyStatus,
    method: 'post',
    data: parameter,
  })
}

export function generateTokenByGoodsAgent(data) {
  return axios({
    url: api.generateTokenByGoodsAgent,
    method: 'post',
    data,
  })
}

export function generateTokenByFrontAgent(data) {
  return axios({
    url: api.generateTokenByFrontAgent,
    method: 'post',
    data,
  })
}

export function getAreaAgent(params) {
  return axios({
    url: api.getAreaAgent,
    method: 'get',
    params,
  })
}

export function getAgentApplyList(params) {
  return axios({
    url: api.getAgentApplyList,
    method: 'get',
    params,
  })
}

export function setAgentApplyStatus(data) {
  return axios({
    url: api.setAgentApplyStatus,
    method: 'post',
    data,
  })
}

export function userLevelSearch(params) {
  return axios({
    url: '/cloud/platform/user-level-search',
    method: 'get',
    params,
  })
}

export function setUserLevelStatus(params) {
  return axios({
    url: '/cloud/platform/set-user-level-status',
    method: 'get',
    params,
  })
}

export function setUserLevel(data) {
  return axios({
    url: '/cloud/platform/set-user-level',
    method: 'post',
    data,
  })
}

export function saaSgetAdminList(params) {
  return axios({
    url: '/saas-staff/get-admin-list',
    method: 'get',
    params,
  })
}

export function saaScreateAdmin(data) {
  return axios({
    url: '/saas-staff/create-admin',
    method: 'post',
    data,
  })
}

export function saaSeditAdmin(data) {
  return axios({
    url: '/saas-staff/edit-admin',
    method: 'post',
    data,
  })
}

export function saaSdeleteAdmin(parameter) {
  return axios({
    url: '/saas-staff/delete-admin',
    method: 'post',
    data: parameter,
  })
}

export function saaSgetRoleList(params) {
  return axios({
    url: '/saas-staff/get-role-list',
    method: 'get',
    params,
  })
}

export function saaSgetPermission(params) {
  return axios({
    url: '/saas-staff/get-permission',
    method: 'get',
    params,
  })
}

export function saaScreateRole(data) {
  return axios({
    url: '/saas-staff/create-role',
    method: 'post',
    data,
  })
}

export function saaSeditRole(data) {
  return axios({
    url: '/saas-staff/edit-role',
    method: 'post',
    data,
  })
}

export function saaSdeleteRole(data) {
  return axios({
    url: '/saas-staff/delete-role',
    method: 'post',
    data,
  })
}
